#ifndef __IndexDB_h__
#define __IndexDB_h__

#include <string>

#include "FileSystem/File.h"
#include "FastDB/Types.h"

class IndexDB
{
private:
	File myFile;
	mutable SizeType iFirstFree;
	
	IndexDB(const IndexDB&);
	IndexDB& operator=(const IndexDB&);

	SizeType findFirstFree() const; 
public:
	IndexDB(const char * filePath);
	~IndexDB();
	
	bool IsFull() const;
	
	SizeType CreateFile(SizeType iFirstRecordID, SizeType iLastRecordID);
	
	bool UpdateFirstRecord(SizeType iFileID, SizeType iFirstRecordID);
	bool UpdateLastRecord(SizeType iFileID, SizeType iLastRecordID);
	
	SizeType GetFirstRecord(SizeType iFileID) const;
	SizeType GetLastRecord(SizeType iFileID) const;
	
	bool GetFileRecord(SizeType iFileID, sFileRecord & result) const;
	
};

#endif
